package cn.itcast.spring.demo5;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.itcast.spring.demo4.Person;

public class PropertyTestCase {

	@Test
	public void getTom() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		Tom bean = (Tom) context.getBean("tom");
		System.out.println(bean.toString());
	}


	@Test
	public void getTom1() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		
		Tom bean = (Tom) context.getBean("tom1");
		System.out.println(bean.toString());
	}
	
	/**
	 * 通过C名称空间来简化我们的构造器的属性赋值
	 * @throws Exception
	 */
	@Test
	public void getTomWithCproperty() throws Exception {
		ApplicationContext  context = new ClassPathXmlApplicationContext("applicationContext.xml");
		Tom bean = (Tom) context.getBean("tom3");
		System.out.println(bean.toString());
	}
	
	

}
